﻿using Playnite.Common;
using Playnite.SDK.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LocalGameLibrary
{
    public static class Utils
    {
        public static string GetLastFolderName(string path)
        {
            var temp = Path.GetDirectoryName(path).EndWithDirSeparator();
            return path.Replace(temp, "");
        }
        public static void WriteJsonFile(String filePath, object obj)
        {
            //var filePath = Path.Combine(path, @"LocalGameMetadata.json");
            FileSystem.PrepareSaveFile(filePath);
            File.WriteAllText(filePath, Serialization.ToJson(obj));
        }
    }
}
